import type { FunctionComponent } from "react";
import { Image } from "antd";
import ImagePlaceholder from "./ImagePlaceholder";

/** 文章展示图片*/
interface ArticleImageTypes {
  image: false | string;
  title: string;
}
/** 文章图片 需要在外部提前判断是否需要渲染（内部断言image为string）*/
const ArticleImage: FunctionComponent<ArticleImageTypes> = props => {
  return (
    <>
      <Image
        width={168}
        height={98}
        preview={false}
        src={props.image as string}
        alt={props.title}
        fallback={``}
        placeholder={<ImagePlaceholder />}
      />
    </>
  );
};
export default ArticleImage;
